<?php
function entity_import_training(Infinity\Entity $entity, $values) {
  $nid = Infinity\Query::select('node', 'n', array(
    'status' => 1, 'title' => $values[0], 'type' => 'training'
  ))
    ->fields('n', array('nid'))
    ->execute()
    ->fetchField();
  if($nid) {
    $training = Infinity\Entity::load('node', $nid);
    $training->fieldManager()
      ->setValue('field_trainee_ref', 'target_id', $entity->nid, -1)
      ->save();
  }
}